/* stylelint-disable no-duplicate-selectors */
/* stylelint-disable no-descending-specificity */
/* stylelint-disable selector-max-attribute */
/* stylelint-disable selector-max-type */
@import '../style/var.less';

.van-native-button {
  position: absolute;
  padding: 0;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background-color: transparent;
  opacity: 0;
  z-index: 1;

  &::after {
    display: none;
  }
}

.van-button {
  position: relative;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  text-align: center;
  box-sizing: border-box;
  display: inline-flex;
  vertical-align: bottom;

  &:active:not(&--disabled) {
    .theme(opacity, '@button-active-opacity');
  }

  .theme(line-height, '@button-line-height');

  // mini图标默认宽度100px，文字不能超过4个
  &--mini {
    display: inline-block;
    .theme(padding, '0 @padding-base');
    .theme(height, '@button-mini-height');
    .theme(line-height, '@button-mini-height');
    .theme(font-size, '@button-mini-font-size');
    .theme(min-width, '@button-mini-min-width');
    .theme(border-radius, '@button-mini-border-radius');

    & + .van-button--mini {
      margin-left: 10px;
    }
  }

  &--small {
    .theme(padding, '0 @padding-xs');
    .theme(height, '@button-small-height');
    .theme(font-size, '@button-small-font-size');
    .theme(min-width, '@button-small-min-width');
    .theme(border-radius, '@button-small-border-radius');
  }

  &--normal {
    .theme(padding, '0 @padding-md');
    .theme(height, '@button-normal-height');
    .theme(font-size, '@button-normal-font-size');
    .theme(border-radius, '@button-normal-border-radius');
  }

  &--large {
    width: 100%;
    .theme(height, '@button-large-height');
    .theme(font-size, '@button-large-font-size');
    .theme(border-radius, '@button-normal-border-radius');
  }

  &--default {
    .theme(color, '@button-default-color');
    .theme(background, '@button-default-background-color');
  }

  &--primary {
    .theme(color, '@button-primary-color');
    .theme(background, '@button-primary-background-color');
  }

  &--info {
    .theme(color, '@button-info-color');
    .theme(background, '@button-info-background-color');
  }

  &--danger {
    .theme(color, '@button-danger-color');
    .theme(background, '@button-danger-background-color');
  }

  &--warning {
    .theme(color, '@button-warning-color');
    .theme(background, '@button-warning-background-color');
  }

  &--plain {
    .theme(background, '@button-plain-background-color');

    overflow: hidden;

    &.van-button--primary {
      .theme(color, '@button-primary-background-color');
    }

    &.van-button--info {
      .theme(color, '@button-info-background-color');
    }

    &.van-button--danger {
      .theme(color, '@button-danger-background-color');
    }

    &.van-button--warning {
      .theme(color, '@button-warning-background-color');
    }
  }

  &--block {
    display: flex;
    width: 100%;
  }

  &--round {
    .theme(border-radius, '@button-round-border-radius');
  }

  &--square {
    border-radius: 0;
  }

  &--disabled {
    .theme(opacity, '@button-disabled-opacity');
  }

  &__text {
    display: inline;
  }

  &__loading-text,
  &__icon + &__text:not(:empty) {
    .theme(margin-left, '@padding-base');
  }

  &__icon {
    min-width: 1em;
    line-height: inherit !important;
    vertical-align: top;
  }

  &--hairline {
    &.van-button--primary {
      .theme(border, '@button-border-width solid @button-primary-background-color');
    }

    &.van-button--info {
      .theme(border, '@button-border-width solid @button-info-background-color');
    }

    &.van-button--danger {
      .theme(border, '@button-border-width solid @button-danger-background-color');
    }

    &.van-button--warning {
      .theme(border, '@button-border-width solid @button-warning-background-color');
    }
  }

  &--active:not(&--disabled) {
    filter: brightness(0.9);
  }

  &--unclickable {
    pointer-events: none;

    &::after {
      display: none;
    }
  }
}

.van-button + .van-button {
  margin-top: 0;
}
